# Reverse Engineering Wise

Extract files from Wise installers without executing them.

The aim of this project is to extract assets from old game installers made with
Wise installer without executing the PE file (.exe), so they can be used with
free software implementations of the game engine.

```bash
==============================================================
              Welcome to REWise version 0.1.0
==============================================================

 Usage: rewise [OPERATION] [OPTIONS] INPUT_FILE

  OPERATIONS
   -x --extract      OUTPUT_PATH  Extract files.
   -r --raw          OUTPUT_PATH  Extract all files in the overlay data. This does not move/rename files!
   -l --list                      List files.
   -V --verify                    Run extract without actually outputting files, crc32s will be checked.
   -z --script-debug              Print parsed WiseScript.bin
   -v --version                   Print version and exit.
   -h --help                      Display this HELP.

  OPTIONS
   -p --preserve                  Don't delete TMP files.
   -t --tmp-path     TMP_PATH     Set temporary path, default: /tmp/
   -d --debug                     Print debug info.
   -s --silent                    Be silent, don't print anything.
   -n --no-extract                Don't extract anything. This will be ignored with -x or -r. It also will not try to remove TMP files, so -p won't do anything.

  NOTES
    - Path to directory OUTPUT_PATH and TMP_PATH should exist.
```


# State

## What can be done better

In general:

 - Error handling.
 - The inflate process is currently custom made with
   `https://github.com/mnadareski/WiseUnpacker` as a source of information. It
   is doing fine but it probably will be better and faster with a `zlib`
   implementation.

Values that are currently calculated that might be in the WiseHeader,
somewhere in WiseScript.bin or a constant defined somewhere else are:

 - Total inflated size
 - The deflate-offset that is added to deflateStart defined in the
   WiseScript.bin file.

Other values that are of interest but not found yet are:

 - To determine what Wise package/version was used other then the PE build
   date.

## Things that might be a problem

 - REWise is only tested on Little Endian systems.


# Other projects

 - https://github.com/mnadareski/WiseUnpacker
 - https://github.com/lmop/exwise
